<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    function _new(ctor, ...args) {
      if (typeof ctor !== 'function') {
        throw 'cytor must be a function';
      }
      let obj = new Object();
      obj.__proto__ = Object.create(ctor.prototype);
      let res = ctor.apply(obj, ...args);

      let isObject = typeof res === 'object' && typeof res !== null;
      let isFunction = typeof res === 'function';
      return isObject || isFunction ? res : obj;
    }
  </script>
</html>
